package com.legsem.legstar.jca;

import javax.resource.ResourceException;
import javax.resource.spi.ManagedConnection;

import com.legsem.legstar.cci.LegStarConnection;
import com.legstar.messaging.HostEndpoint;

public interface LegStarManagedConnection extends ManagedConnection {

    /**
     * @return the host endpoint parameters
     */
    public HostEndpoint getHostEndpoint();

    /**
     * @return the host connection
     */
    public com.legstar.messaging.LegStarConnection getHostConnection();

    /**
     * Notify listeners that a transaction is started.
     */
    public void transactionStarted();

    /**
     * Notify listeners that a transaction is committed.
     */
    public void transactionCompleted();

    /**
     * Notify listeners that a transaction is rolled back.
     */
    public void transactionRolledback();

    /**
     * @return the current CCI connection
     */
    public LegStarConnection getConnection();

    /**
     * close the underlying host connection
     * 
     * @throws ResourceException if close fails
     */
    public void close() throws ResourceException;

    /**
     * An error occurred
     */
    public void onError();
}
